<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>直接写在HTML标签中</title>
    <script>
        function show(){
            alert("你好,JavaScript")
        }
    </script>
</head>
<body>
    <button onclick='javascript:alert("你好,JavaScript")'>单击弹出对话框</button>
    <button onclick="show()">单击弹出对话框2</button>
</body>
</html>